/**
 * 
 */
package de.rotkiv.common.resourcebundle;

import java.util.MissingResourceException;

import de.rotkiv.playlistgenerator.base.IF_PlayListConstants;

/**
 * @author Vik
 *
 */
public class ResourceBundleManager {


	private static ResourceBundleProvider bundle;
	private static final String MISSING_ITEM	= "!";

	private static ResourceBundleProvider getInstance() {
		if (bundle == null) {
			bundle = new ResourceBundleProvider(IF_PlayListConstants.PROP_PATH_RESOURCE_BUNDLE);
		}
		return bundle;
	}

	public static String getText(String key) {

		String text = null;
		try {
			text = getInstance().getText(key);
		} catch (MissingResourceException e) {
			// nothing
		}

		if (text == null) {
			text = MISSING_ITEM + key;
		}

		return text;
	}
}
